﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace House_Control
{
    //This class will deal with everything dealing with Lights in this House.
    class Light : Appliance
    {
        //The brightness of this light.
        int brightness;
        //We need this variable for calling the constructor of the base class.
        static int applianceType = Appliance.LIGHT;

        //In C#, you use : base() to call the constructor of the base class and in this case the constructor takes applianceType as an argument.
        public Light() : base(applianceType)
        {
            brightness = 0;
        }

        public void brighten()
        {
            brightness++;
            checkBrightness();
        }

        public void dim()
        {
            brightness--;
            checkBrightness();
        }

        public int getBrightness()
        {
            return brightness;
        }

        public void setBrightness(int bright)
        {
            brightness = bright;
            checkBrightness();
        }

        //This method makes sure the brightness doesnt go below 0 or above 100.
        public void checkBrightness()
        {
            if (brightness < 0) brightness = 0;
            if (brightness > 100) brightness = 100;
        }
    }
}
